<?php
session_start();
if(!@$_SESSION['username']) {
  echo "<script>window.location.href='login.php';</script>";
}
?>4<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>change status</title>
</head>
<body>


<?php
include_once('../../libraries/esaydb.class.php');
if($_GET['uid'] && $_GET['status']) {
	if($_GET['status'] == 'yes') {
		$new = 'no';
	}else if($_GET['status'] == 'no') {
		$new = 'yes';
	}
	$db = new EasyDB();
	$set = array('status'=>$new);
	$where = array('uid'=>$_GET['uid']);
	$result  = $db->update('ob_user',$set,$where);
	if($result) {
		echo "<script>alert('修改成功');window.location.href='../../user-all-list.php';</script>";
	}else{
		echo "<script>alert('修改失败');history.go(-1);</script>";
	}
}else{
	echo "<script>alert('no');history.go(-1);</script>";
}
?>
</body>
</html>
